<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>8.组件数据传递:父->子</title>
    <script src="js/vue.js"></script>
</head>

<body>
    <div id="app">
        <blog-title v-for="post in posts" :key="post.id" :title1="post.title" :post="post"></blog-title>
    </div>
    
    <script>
        var blog = {
            props:{'title1':[],'post':{}},
            template: '<h4>{{title1}}{{post}}</h4>'
        }

        var vm = new Vue({
            el: '#app',
            components:{'blogTitle': blog},
            data: {
                posts: [
                    { id: 1, title: '博客标题1' },
                    { id: 2, title: '博客标题2' },
                    { id: 3, title: '博客标题3' }
                ]
            },

        })
    </script>
</body>

</html>